// 主要对文章进行处理

import axios from '@/utils/myaxios.js';

// params: { pageSize, '', pageIndex: '', category: '' }
export const getArticleList = (params) => {
  return axios({
    url: '/post',
    params,
  });
};

// 获取文章详情
export const getArticleDetailById = (id) => {
  return axios({
    url: `/post/${id}`
  });
};

// 文章点赞
export const post_like = (id) => {
  return axios({
    url: `/post_like/${id}`
  });
};

// 文章收藏
export const post_star = (id) => {
  return axios({
    url: `/post_star/${id}`
  });
};

// 获取文章评论列表
export const getArticleCommentsList = (id) => {
  return axios({
    url: `/post_comment/${id}`
  });
};

// 回复评论
export const replyComment = (id, data) => {
  return axios({
    method: 'post',
    url: `/post_comment/${id}`,
    data
  });
};

// 文章搜索
export const searchArticles = (keyword) => {
  return axios({
    url: '/post_search',
    params: { keyword }
  });
};